"use strict";
require("test").setup();

var Coroutine = require('coroutine');
var hash = require('hash');

var str_prefix = "ZG";

describe("user", function() {
    before(function() {
    });
    after(function() {
         clearDB();
    });


    it("登录", function() {
        httpPost("GET", "/v1.0/api/user/Sync", {})
        var t = "123"
        var result = httpPost("POST", "/v1.0/api/user/WebLogin", {
            "phone": "18888888888",
            "password": hash.md5(hash.md5("ZHYQ2022").digest().hex() + t).digest().hex(),
            "t": t,
        })
        assert.equal(result.code, "200");
        assert.equal(result.data.id, 2);
        assert.equal(result.data.role, "超级管理员");
        assert.equal(result.data.edited_password, true);
    });


    it("获取患者入院信息 ", function () {
        var result = httpPost("POST", "/v1.0/api/query/patient_info_en", {
        })
        console.error("获取患者入院信息",result)
        assert.equal(result.code, "200");
        assert.equal(result.msg, "success");
    });
});

require('test').run();